/**
 * 角色详情对话框
 */
var RoleInfoDlg = {
    data: {
        pid: "",
        pName: ""
    }
};

layui.use(['layer', 'form', 'admin', 'ax','rate','util'], function () {
    var $ = layui.jquery;
    var $ax = layui.ax;
    var form = layui.form;
    var admin = layui.admin;
    var layer = layui.layer;
    var rate = layui.rate;
    var util = layui.util;
    // 让当前iframe弹层高度适应
    admin.iframeAuto();

    //初始详情数据

    var ajax = new $ax(Feng.ctxPath + "/meter/meterDetailData/"  + Feng.getUrlParam("id"));
    var result = ajax.start();
    //工单进度
    result.data.meterSchedule.forEach((item,index) =>{
        var content= '<li class="layui-timeline-item" style="padding-bottom: 38px;"><img  src="/assets/common/images/finish.svg" style="position: absolute;top: -2px;width: 28px;height: 28px"> ' +
            '<div class="layui-timeline-content layui-text" style="margin-left: 14px;">' +
            '<div style="float: left;font-size: 16px;color: rgba(14,31,53,0.85);">'+item.remark+'</div>' +
            '<div style="float: right;font-size: 12px;color: rgba(0,0,0,0.45);margin-right: 9px;" class="layui-timeline-title">  '+util.toDateString(new Date(item.createTime).getTime(),"yyyy-MM-dd HH:mm:ss")+'</div>' +
            '<br><div style="font-size: 14px;color: rgba(0,0,0,0.45);     line-height: 20px;\n' +
            '    margin-top: 4px;">'+item.createUser+'['+item.role+']</div>' +
            '<div style="font-size: 12px;color: rgba(0,0,0,0.45);    line-height: 17px;\n' +
            '    margin-top: 10px;word-break: break-all;">'+item.posOperationDesc+'</div> </div> </li>'
            $("#repairSchedule").append(content)

        var content2=`<div class="layui-form-item">
                        <div class="layui-row">
                            <div class="layui-col-xs6">
                                <div class="layui-inline">

                                </div>
                            </div>

                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-row">
                            <div class="layui-col-xs6">
                                <div class="layui-inline">

                                </div>
                            </div>

                        </div>
                    </div>
                   <div class="layui-form-item">
                        <div class="layui-row">
                            <div class="layui-col-xs6">
                                <div class="layui-inline">

                                </div>
                            </div>

                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-row">
                            <div class="layui-col-xs6">
                                <div class="layui-inline">

                                </div>
                            </div>

                        </div>
                    </div>`
        $("#left").append(content2)

    })
    admin.iframeAuto();
    $("#submitImages").on("click",".repair-img",function () {
        previewImg($(this).attr("src"))
    })

    //详情字段填充
    $("#shopName").text(result.data.shopName)//商户名
    $("#shopAdr").text(result.data.shopAdr)//商户地址
    $("#meterNo").text(result.data.meterNo)//报事人
    $("#createTime").text(util.toDateString(result.data.createTime,'yyyy-MM-dd HH:mm:ss'))//报事时间






});
